import { param2Obj } from '@/utils'

const permissionMap = {
  dba: [{
    title: '资产管理',
    name: 'cmdb',
    children: [
      { title: '机房等级', name: 'idclevel' },
      { title: 'ISP类型', name: 'isp' },
      { title: '供应商', name: 'supplier' },
      { title: '机房', name: 'idc' },
      { title: '机柜', name: 'cabinet' },
      { title: '机架', name: 'rack' },
      { title: '主机', name: 'host' },
      { title: '网络设备', name: 'device' }

    ]
  },
  {
    title: '应用管理',
    name: 'app',
    children: [
      { title: '应用分类', name: 'type' },
      { title: '数据库端口', name: 'databaseport' },
      { title: '应用系统', name: 'system' }

    ]
  }]
}

export default {
  getPermissions: config => {
    const { token } = param2Obj(config.url)
    if (permissionMap[token]) {
      return permissionMap[token]
    } else {
      return false
    }
  }
}
